<%@page import="model.constraints.synthesized.attributes.SyntAttributesAbstract"%>
<%@ page import="model.validator.*"%>
<%@ page import="model.constraints.*"%>
<%@ page import="model.constraints.synthesized.*"%>
<%@ page import="model.constraints.inherited.*"%>
<%@ page import="java.util.Stack"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.HashMap"%>
<jsp:include page="includes/head.jsp" /> 
<div id="box">
    
<jsp:include page="includes/nav.jsp" />
        
        <div id="box-content">                           
     		<h2>Results Constraint</h2>               
                   
           	<p>In this page you will see the <strong>results</strong> of validation and see the <strong>FSA</strong> of automata.</p>
           	<p>If you want validate again you need click on  <a href="${initParam.url}validate-xml.jsp">validate XML</a></p> 
           <div class="line"></div>   
            
            <table border="1">
              <tr>
                <th>Name</th>
                <th>Result</th>    
                <th>Constraint</th>                                
                <th colspan="3">Commands</th>
              </tr>
              
              <%
                            	int i=0; 
                            	            String key = new String();
                            	              
                                          	HashMap<String, ValidateSaxParse> validate = (HashMap<String, ValidateSaxParse>) session.getAttribute("validate");
                            	  	        	for (String k : validate.keySet()) 
                            	  	        		key = k;
                            	  	        
                            	            for(ObserverSaxParser restricao : validate.get(key).getConstraints()) {
                            			Stack<Vector<SyntAttributesAbstract>> synt = new Stack<Vector<SyntAttributesAbstract>>();	            	  
                            			AbstractConstraint ab = (AbstractConstraint) restricao.getConstraint();
                            			synt = (Stack<Vector<SyntAttributesAbstract>>) restricao.getStackSynt();
                            %>				  			      	            				              
	              <tr>
	                <td><%= ab.getNameConstraint() %></td>
	                <td><%= synt.peek().get(0).getC().toString() %></td>                
	                <td><%= restricao.getResult() %></td>                                
	                <td> <a class="inframe" href="more-results.jsp?id=<%= i %>">more</a></td>
					<td><a href="edit?id=<%= i %>" >edit</a></td>
					<td><a href="deleteResults?id=<%= i %>">delete</a></td>	
	              </tr>
              
             	 <% i++; } %>       
                            
            </table>
                                      
                                         
            </div>     
                                                                                     
        <div class="clear"></div>
    </div>   
</body>
</html>